<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
// use Illuminate\Http\Response;
use App\Model\District;
use DB;


/**
 * @author 张健领
 * 详情页ajax处理
 */
class ShopController extends Controller
{
	//城市三级联动
	public function Area()
	{
		
		$upid = intval($_POST['upid']);
		$data = District::select('id','name','upid')->where('upid', $upid)->get();
		if ($data) {
			$result = [
				'code' => 200,
				'msg'  => '成功',
				'data' => $data,
			];
		}
		
		return json_encode($result);
	}

	//商品属性读取
	public function attrs()
	{

		$tid = $_POST['typeid'];

		$data = DB::table('shop_attr')->select('type', 'attr', 'subtotal', 'id')->where('id' , $tid )->get();


		return json_encode($data);

	}


}
